import { createApp } from 'vue';
import LargeUI from 'nc-large-screen-ui';
import DataV from '@dataview/datav-vue3-component';

// svg雪碧图
import 'virtual:svg-icons-register';
// 防止打包后报错
import dayjs from 'dayjs';
import App from './App.vue';
import { setupRouter } from '@/router/index.js';
import { setupStore } from '@/stores/index.js';
import { initializer } from '@/core/bootstrap';
import { setupAssets } from '@/core/assets';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import NstdComp from 'nstd-components-pc-v3';
import zhCn from 'nstd-components-pc-v3/locale/lang/zh-cn';

async function setupApp() {
  setupAssets();
  const app = createApp(App);
  // 这个放在前面, 不然影响了el-loading
  app.use(DataV, { classNamePrefix: 'dv-' });
  app.config.globalProperties.dayjs = dayjs;
  // 注册pinia
  setupStore(app);
  initializer();
  // 注册路由
  await setupRouter(app);
  app.use(LargeUI);
  app.use(NstdComp, { locale: zhCn });
  app.use(ElementPlus);
  app.mount('#ddywgk-app');
}

setupApp();
